﻿@namespace Bit.BlazorUI
@inherits ErrorBoundaryBase

@if (CurrentException is null)
{
    @(Body ?? ChildContent)
}
else if (ErrorContent is not null)
{
    @ErrorContent(CurrentException)
}
else
{
    <div class="bit-erb">
        <svg width="64" height="64" viewBox="0 0 64 64" fill="none">
            <path d="M30.268 3C31.0378 1.66666 32.9622 1.66667 33.7321 3L57.9808 45C58.7506 46.3333 57.7883 48 56.2487 48H7.75129C6.21169 48 5.24944 46.3333 6.01924 45L30.268 3Z" fill="#FFDAD4" />
            <path d="M29.0025 24C29.0025 22.8954 29.8979 22 31.0025 22H32C33.1046 22 34 22.8954 34 24V32.5C34 33.6046 33.1046 34.5 32 34.5H31.0025C29.8979 34.5 29.0025 33.6046 29.0025 32.5V24ZM29 39C29 37.8954 29.8954 37 31 37H31.9975C33.1021 37 33.9975 37.8954 33.9975 39V40C33.9975 41.1046 33.1021 42 31.9975 42H31C29.8954 42 29 41.1046 29 40V39Z" fill="#A4262C" />
        </svg>

        <BitText Color="BitColor.Error" Typography="BitTypography.H3">
            @(Title ?? "Oops, Something went wrong...")
        </BitText>

        @if (ShowException)
        {
            <div class="bit-erb-exp">
                @CurrentException?.ToString()
            </div>
        }

        @if (Footer is not null)
        {
            @Footer
        }
        else
        {
            <div class="bit-erb-ftr">
                <BitButton OnClick="Refresh">@(RefreshText ?? "Refresh")</BitButton>
                <BitButton OnClick="GoHome" Variant="BitVariant.Outline">@(HomeText ?? "Home")</BitButton>
                <BitButton OnClick="Recover" Variant="BitVariant.Outline">@(RecoverText ?? "Recover")</BitButton>
                @if (AdditionalButtons is not null)
                {
                    @AdditionalButtons
                }
            </div>
        }
    </div>
}